﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

namespace ClientPerformance
{
    /// <summary>
    /// Propagation Filter to remove any messages that this node sends from being recieved by this node.
    /// </summary>
    public class RemoteOnlyMessagePropagationFilter : PeerMessagePropagationFilter
    {
        public RemoteOnlyMessagePropagationFilter()
        { }

        public override PeerMessagePropagation ShouldMessagePropagate(System.ServiceModel.Channels.Message message, PeerMessageOrigination origination)
        {
            PeerMessagePropagation destination = PeerMessagePropagation.LocalAndRemote;

            if (origination == PeerMessageOrigination.Local)
                destination = PeerMessagePropagation.Remote;

            return destination;
        }
    }
}
